<g:if test="${flash.message}">
    <div class="message">${flash.message}</div>
</g:if>
<g:hasErrors bean="${staffInstance}">
    <div class="errors">
        <g:renderErrors bean="${staffInstance}" as="list"/>
    </div>
</g:hasErrors>
<g:form action="save" method="post">
    <div class="dialog">
        <table>
            <tbody>

            <tr class="prop">
                <td valign="top" class="name">
                    <label for="name"><g:message code="staff.table.name"/><ps:mandatory/>:</label>
                </td>
                <td valign="top" class="value ${hasErrors(bean: staffInstance, field: 'name', 'errors')}">
                    <input type="text" id="name" name="name" value="${fieldValue(bean: staffInstance, field: 'name')}"/>
                </td>
            </tr>

            <tr class="prop">
                <td valign="top" class="name">
                    <label for="handPhone"><g:message code="staff.table.phone"/><ps:mandatory/>:</label>
                </td>
                <td valign="top" class="value ${hasErrors(bean: staffInstance, field: 'handPhone', 'errors')}">
                    <input type="text" id="handPhone" name="handPhone" value="${fieldValue(bean: staffInstance, field: 'handPhone')}"/>
                </td>
            </tr>

            <tr class="prop">
                <td valign="top" class="name">
                    <label for="homePhone"><g:message code="staff.table.home.phone"/>:</label>
                </td>
                <td valign="top" class="value ${hasErrors(bean: staffInstance, field: 'homePhone', 'errors')}">
                    <input type="text" id="homePhone" name="homePhone" value="${fieldValue(bean: staffInstance, field: 'homePhone')}"/>
                </td>
            </tr>

            <tr class="prop">
                <td valign="top" class="name">
                    <label for="street"><g:message code="staff.table.street"/>:</label>
                </td>
                <td valign="top" class="value ${hasErrors(bean: staffInstance, field: 'street', 'errors')}">
                    <input type="text" id="street" name="street" value="${fieldValue(bean: staffInstance, field: 'street')}"/>
                </td>
            </tr>

            <tr class="prop">
                <td valign="top" class="name">
                    <label for="postalCode"><g:message code="staff.table.postal"/>:</label>
                </td>
                <td valign="top" class="value ${hasErrors(bean: staffInstance, field: 'postalCode', 'errors')}">
                    <input type="text" id="postalCode" name="postalCode" value="${fieldValue(bean: staffInstance, field: 'postalCode')}"/>
                </td>
            </tr>

            <tr class="prop">
                <td valign="top" class="name">
                    <label for="group"><g:message code="staff.table.group"/>:</label>
                </td>
                <td valign="top" class="value ${hasErrors(bean: staffInstance, field: 'group', 'errors')}">
                    <g:select optionKey="id" from="${StaffGroup.list()}" name="group.id" value="${staffInstance?.group?.id}"/>
                </td>
            </tr>

            <tr class="prop">
                <td valign="top" class="name">
                    <label for="commissionPolicyGroup"><g:message code="staff.table.commissionPolicyGroup"/>:</label>
                </td>
                <td valign="top" class="value ${hasErrors(bean: staffInstance, field: 'commissionPolicyGroup', 'errors')}">
                    <g:select optionKey="id" from="${CommissionPolicyGroup.list()}" name="commissionPolicyGroup.id" value="${staffInstance?.commissionPolicyGroup?.id}"/>
                </td>
            </tr>

            </tbody>
        </table>
    </div>
    <div class="buttons">
        <input type="hidden" name="id" value="${staffInstance?.id}" />
        <g:if test="${staffInstance.id == null}">
            <span class="button"><input class="save" type="submit" value="${message(code: 'common.button.save')}"/></span>
        </g:if>
        <g:else>
            <span class="button"><g:actionSubmit class="save" value="${message(code: 'staff.nav.edit')}" action="update"/></span>
            <span class="button"><g:actionSubmit class="delete" id="${staffInstance?.id}" onclick="return confirm('${message(code:'common.delete.confirm')}');" value="Delete"/></span>
        </g:else>
    </div>
</g:form>

